package cn.itcast.orders.controller;

import cn.itcast.orders.mapper.OrderMapper;
import cn.itcast.orders.service.OrderService;
import cn.itcast.orders.vo.OrderOverViewVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 专门用与feign远程调用
 */
@RestController
//@RequestMapping("/feign/order")
@RequestMapping()
public class OrderFeignController {

    @Autowired
    private OrderMapper orderMapper;


    @PostMapping("/sumByMap")
    Double sumByMap(@RequestBody Map<String, Object> map){
        return orderMapper.sumByMap(map);
    }

    @PostMapping("/getTop10ByMap")
    List<Map<String, Object>> getTop10ByMap(@RequestBody Map<String, Object> map){
        return orderMapper.getTop10ByMap(map);
    }

    @GetMapping("/getAllOrderStatus")
    public OrderOverViewVO getAllOrderStatus(){
        return orderMapper.getAllOrderStatus();
    }


    @PostMapping("/getAllOrderCount")
    Integer getAllOrderCount(@RequestBody Map<String, Object> map){
        return orderMapper.getAllOrderCount(map);
    }





}
